﻿#include <QtCore/QCoreApplication>
#include <QPluginLoader>
#include <iostream>

#include"IMyDll.h"	//引入接口类

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

	//加载插件
	QPluginLoader pluginLoader(qApp->applicationDirPath() + "/plugins/MyDlld.dll");	//exe路径里的插件
	IMyDll* plugin = qobject_cast<IMyDll*> (pluginLoader.instance());				//实例化，接口类对象
	if (plugin==nullptr)
	{
		return -1;
	}
	plugin->setNumber(10);
	std::cout << plugin->getNumber() << std::endl;
	std::cout << plugin->title().toStdString() << std::endl;
	std::cout << plugin->version().toStdString() << std::endl;

    return a.exec();
}
